<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Regular IPA passes (GNU Compiler Collection (GCC) Internals)</title>

<meta name="description" content="Regular IPA passes (GNU Compiler Collection (GCC) Internals)">
<meta name="keywords" content="Regular IPA passes (GNU Compiler Collection (GCC) Internals)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Option-Index.html" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="IPA-passes.html" rel="up" title="IPA passes">
<link href="Late-IPA-passes.html" rel="next" title="Late IPA passes">
<link href="Small-IPA-passes.html" rel="prev" title="Small IPA passes">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
ul.mark-bullet {list-style-type: disc}
-->
</style>


</head>

<body lang="en">
<div class="subsection-level-extent" id="Regular-IPA-passes">
<div class="nav-panel">
<p>
Next: <a href="Late-IPA-passes.html" accesskey="n" rel="next">Late IPA passes</a>, Previous: <a href="Small-IPA-passes.html" accesskey="p" rel="prev">Small IPA passes</a>, Up: <a href="IPA-passes.html" accesskey="u" rel="up">Inter-procedural optimization passes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Regular-IPA-passes-1"><span>9.4.2 Regular IPA passes<a class="copiable-link" href="#Regular-IPA-passes-1"> &para;</a></span></h4>
<a class="index-entry-id" id="index-regular-IPA-passes"></a>

<p>A regular IPA pass is a pass derived from <code class="code">ipa_opt_pass_d</code> that
is executed in WHOPR compilation. Regular IPA passes may have summary
hooks implemented in any of the LGEN, WPA or LTRANS stages (see <a class="pxref" href="IPA.html">Using summary information in IPA passes</a>).
</p>
<ul class="itemize mark-bullet">
<li>IPA whole program visibility

<p>This pass performs various optimizations involving symbol visibility
with <samp class="option">-fwhole-program</samp>, including symbol privatization,
discovering local functions, and dismantling comdat groups.  It is
located in <samp class="file">ipa-visibility.cc</samp> and is described by
<code class="code">pass_ipa_whole_program_visibility</code>.
</p>
</li><li>IPA profile

<p>The IPA profile pass propagates profiling frequencies across the call
graph.  It is located in <samp class="file">ipa-profile.cc</samp> and is described by
<code class="code">pass_ipa_profile</code>.
</p>
</li><li>IPA identical code folding

<p>This is the inter-procedural identical code folding pass.
The goal of this transformation is to discover functions
and read-only variables that have exactly the same semantics.  It is
located in <samp class="file">ipa-icf.cc</samp> and is described by <code class="code">pass_ipa_icf</code>.
</p>
</li><li>IPA devirtualization

<p>This pass performs speculative devirtualization based on the type
inheritance graph.  When a polymorphic call has only one likely target
in the unit, it is turned into a speculative call. It is located in
<samp class="file">ipa-devirt.cc</samp> and is described by <code class="code">pass_ipa_devirt</code>.
</p>
</li><li>IPA constant propagation

<p>The goal of this pass is to discover functions that are always invoked
with some arguments with the same known constant values and to modify
the functions accordingly.  It can also do partial specialization and
type-based devirtualization.  It is located in <samp class="file">ipa-cp.cc</samp> and is
described by <code class="code">pass_ipa_cp</code>.
</p>
</li><li>IPA scalar replacement of aggregates

<p>This pass can replace an aggregate parameter with a set of other parameters
representing part of the original, turning those passed by reference
into new ones which pass the value directly.  It also removes unused
function return values and unused function parameters.  This pass is
located in <samp class="file">ipa-sra.cc</samp> and is described by <code class="code">pass_ipa_sra</code>.
</p>
</li><li>IPA constructor/destructor merge

<p>This pass merges multiple constructors and destructors for static
objects into single functions.  It&rsquo;s only run at LTO time unless the
target doesn&rsquo;t support constructors and destructors natively.  The
pass is located in <samp class="file">ipa.cc</samp> and is described by
<code class="code">pass_ipa_cdtor_merge</code>.
</p>
</li><li>IPA function summary

<p>This pass provides function analysis for inter-procedural passes.
It collects estimates of function body size, execution time, and frame
size for each function.  It also estimates information about function
calls: call statement size, time and how often the parameters change
for each call.  It is located in <samp class="file">ipa-fnsummary.cc</samp> and is
described by <code class="code">pass_ipa_fn_summary</code>.
</p>
</li><li>IPA inline

<p>The IPA inline pass handles function inlining with whole-program
knowledge. Small functions that are candidates for inlining are
ordered in increasing badness, bounded by unit growth parameters.
Unreachable functions are removed from the call graph.  Functions called
once and not exported from the unit are inlined.  This pass is located in
<samp class="file">ipa-inline.cc</samp> and is described by <code class="code">pass_ipa_inline</code>.
</p>
</li><li>IPA pure/const analysis

<p>This pass marks functions as being either const (<code class="code">TREE_READONLY</code>) or
pure (<code class="code">DECL_PURE_P</code>).  The per-function information is produced
by <code class="code">pure_const_generate_summary</code>, then the global information is computed
by performing a transitive closure over the call graph.   It is located in
<samp class="file">ipa-pure-const.cc</samp> and is described by <code class="code">pass_ipa_pure_const</code>.
</p>
</li><li>IPA free function summary

<p>This pass is a regular IPA pass when argument <code class="code">small_p</code> is false.
It releases inline function summaries and call summaries.
It is located in <samp class="file">ipa-fnsummary.cc</samp> and is described by
<code class="code">pass_ipa_free_fn_summary</code>.
</p>
</li><li>IPA reference

<p>This pass gathers information about how variables whose scope is
confined to the compilation unit are used.  It is located in
<samp class="file">ipa-reference.cc</samp> and is described by <code class="code">pass_ipa_reference</code>.
</p>
</li><li>IPA single use

<p>This pass checks whether variables are used by a single function.
It is located in <samp class="file">ipa.cc</samp> and is described by
<code class="code">pass_ipa_single_use</code>.
</p>
</li><li>IPA comdats

<p>This pass looks for static symbols that are used exclusively
within one comdat group, and moves them into that comdat group. It is
located in <samp class="file">ipa-comdats.cc</samp> and is described by
<code class="code">pass_ipa_comdats</code>.
</p>
</li></ul>

</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Late-IPA-passes.html">Late IPA passes</a>, Previous: <a href="Small-IPA-passes.html">Small IPA passes</a>, Up: <a href="IPA-passes.html">Inter-procedural optimization passes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
